const path = require("path");
const resolve = (dir) => path.join(__dirname, dir);
import sitemap from "./static/sitemap";
// const env = require('./env')
// console.log(process.env.MODE.baseUrl)
export default {
  // Global page headers: https://go.nuxtjs.dev/config-head
  // env: {
  //   MODE: process.env.MODE
  // },
  head: {
    title: "哩哩口腔官网",
    //title: 'test',
    htmlAttrs: {
      lang: "en",
    },
    meta: [
      { charset: "utf-8" },
      { hid: "description", name: "description", content: "" },
      { name: "format-detection", content: "telephone=no" },
      { "http-equiv": "Cache-Control", content: "no-transform" },
      { "http-equiv": "Cache-Control", content: "no-siteapp" },
      { name: "applicable-device", content: "pc" },
    ],
    link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.ico" }],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: ["element-ui/lib/theme-chalk/index.css", "~/assets/styles/base.less"],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    "@/plugins/element-ui",
    "~/plugins/axios",
    "~/plugins/common",
    { src: "@/plugins/router", ssr: false },
    { src: "@/plugins/methods" },
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    "@nuxtjs/axios",
    "@nuxt/postcss8",
    "cookie-universal-nuxt",
    "@nuxtjs/robots",
    "@nuxtjs/sitemap"
  ],

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    vendor: ["element-ui"],
    babel: {
      plugins: [
        [
          "component",
          {
            libraryName: "element-ui",
            styleLibraryName: "theme-chalk",
          },
        ],
      ],
      comments: true,
    },
  },
  router: {
    scrollBehavior(to, from, savedPosition) {
      return { x: 0, y: 0 };
    },
    middleware:'midd'
  },
  generate: {
    subFolders: false,
  },
  robots: {
    UserAgent: "*",
    Disallow: "/",
  },
  server: {
    port: 3001, // 正式环境端口
    //port: 3003, // 测试环境端口
    //port: process.env.MODE.port
    host: "0.0.0.0",
  },
  sitemap: sitemap,
};
